import React, { useState } from "react";
import { Form, Input, Button } from "antd-mobile";
// import axios from "../utlis/axios";
// import { register } from "../api/user";
import axios from "axios";
// import Three from "../components/Three/Three";

type Props = {};

const Login = (props: Props) => {
  const onFinish = (values: any) => {
    console.log(values);
    // let res = register("/register", values);
    // console.log(res);
    axios.post("http://localhost:4000/register", values).then((res) => {
      console.log(res);
    });
  };
  return (
    <div>
      <Form
        name="form"
        onFinish={onFinish}
        footer={
          <Button block type="submit" color="primary" size="large">
            注册
          </Button>
        }
      >
        <Form.Header>注册页面</Form.Header>
        <Form.Item name="username" label="姓名" rules={[{ required: true }]}>
          <Input placeholder="请输入姓名" />
        </Form.Item>
        <Form.Item name="password" label="密码" rules={[{ required: true }]}>
          <Input placeholder="请输入姓名" />
        </Form.Item>
        <Form.Item name="email" label="电子邮件" rules={[{ required: true }]}>
          <Input placeholder="请输入姓名" />
        </Form.Item>
        <Form.Item name="age" label="年龄" rules={[{ required: true }]}>
          <Input placeholder="请输入姓名" />
        </Form.Item>
        <Form.Item name="address" label="地址" rules={[{ required: true }]}>
          <Input placeholder="请输入姓名" />
        </Form.Item>
      </Form>
      {/* <Three></Three> */}
    </div>
  );
};

export default Login;
